package org.example.schoolbus.service.impl;

import org.apache.ibatis.jdbc.Null;
import org.example.schoolbus.mapper.CollectionMapper;
import org.example.schoolbus.service.CollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CollectionServiceimpl implements CollectionService {
    @Autowired
    private CollectionMapper collectionMapper;
    @Override
    public int puserphone(String userphone) {
        if (collectionMapper.puserphone(userphone) ==null)
            return 0;
        else
            return 1;
    }
    @Override
    public int luserphone(String userphone) {
        if (collectionMapper.luserphone(userphone) ==null)
            return 0;
        else
            return 1;
    }
    @Override
    public  int addcollection(String userphone,String station_name,String route_name,String collection_style)
    {   int mp=collectionMapper.addcollection(userphone,station_name,route_name,collection_style);
        if(mp!= 0)
        {
            return 1;
        }else
            return 0;
    }

    @Override
    public List<Map<String, Object>> lookcollections(String userphone) {
        List<Map<String,Object>>map=collectionMapper.lookcollections(userphone);
        if(map!=null)
        {
            return map;
        }
        return null;
    }
    @Override
    public List<Map<String, Object>> lookcollectionr(String userphone) {
        List<Map<String,Object>>map=collectionMapper.lookcollectionr(userphone);
        if(map!=null)
        {
            return map;
        }
        return null;
    }

}
